﻿@model RoadQualityEvalAPI.Models.UserModel

@{
    //Layout = "~/Views/Shared/_Layout.cshtml";
    Layout = null;
    ViewBag.Title = "Create User";
}


<br />
<br />
<hgroup class="title">
    <h1>@ViewBag.Title</h1>
</hgroup>
<hr />

<div class="sectionDiv">

    @using (Html.BeginForm())
    {
        
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)

        <fieldset>
            <legend>UserModel</legend>

            <div class="editor-label">
                @Html.LabelFor(m => m.UserName)
            </div>
            <div class="editor-field">
                @Html.EditorFor(m => m.UserName)
                @Html.ValidationMessageFor(m => m.UserName)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.HashedPass)
            </div>
            <div class="editor-field">
                @Html.EditorFor(m => m.HashedPass)
                @Html.ValidationMessageFor(m => m.HashedPass)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Email)
            </div>
            <div class="editor-field">
                @Html.EditorFor(m => m.Email)
                @Html.ValidationMessageFor(m => m.Email)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.UserInfo)
            </div>
            <div class="editor-field">
                @Html.EditorFor(m => m.UserInfo)
                @Html.ValidationMessageFor(m => m.UserInfo)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.UserRoles)
            </div>
            <div class="editor-field">
                
                @for (int i = 0; i < Model.UserRoles.Count; i++)
                {
                    <div class="row" style="display: inline-block; margin-right: 30px">
                        @Html.CheckBoxFor(m => m.UserRoles[i].Selected)
                        @Html.Label(Model.UserRoles[i].RoleName)
                        @Html.HiddenFor(m => m.UserRoles[i].RoleInfo)
                        @Html.HiddenFor(m => m.UserRoles[i].RoleName)
                        @Html.HiddenFor(m => m.UserRoles[i].RoleId)
                    </div>
                }
                 
            </div>
            
            
            <p>
                <input type="submit" value="Create New User" />
                <input type="button" onclick="location.href='@Url.Action("Index", "Admin")'" class="userBack" value="Back to list" />
             </p>

        </fieldset>
        
    }
    
</div>
